#ifndef __ATCLIENT_H__
#define __ATCLIENT_H__

/**
* @return       TRUE if AT server is ready.
 */
int at_command_server_ready();

/** indication callback function type */
typedef void (*indcb)(const char *indication);

/**
 * @brief        This function send AT cmd to AT cmd server, and get response, this function is sync call.
 *				 Need to read AT cmd doc before use this API
 *
 * @param[in]    atcmd: AT cmd, must add '\r' at the end of cmd, eg."AT+CPIN?\r"
 * @param[in]    timeout: Timeout in seconds.
 * @param[in]    waitok: if wait "OK" or not
 * 						 1 - the response data will auto return when received 'OK', use for reponse data have 'OK' postfix
 *							 like this:
 *							 AT+CPIN?
 * 						 	 +CPIN: ready
 * 						 	 OK
 * 						 	 AT+CFUN=1
 * 						 	 OK
 *						 0 - the response data will auto return when get response, use for response data have no 'OK' postfix
 * @param[out]   outstr: AT response buffer.
 * @param[in]    outlen: The maximum size of outstr.
 *
 * @return       0 is success or error code otherwise.
 */
int atclient_send(const char *atcmd, int timeout, int waitok, char *outstr, int outlen);

/**
 * @brief        This function set callback function that use to receive indications.
 *
 * @param[in]    callback: function use to receive indications from AT cmd server
 *
 */
void atclient_set_ind_cb(indcb callback);

#endif /*__ATCLIENT_H__*/
